<?php
echo "<?php\n";
?>
$this->getNotice();
$this->actionTitle = Yii::t('system', 'Менеджер');
$this->menu=array(
        array(
          'label'         => Yii::t('system', 'Список'),
          'url'           => array('index'), 
          'type'          => 'info',
          'icon'          => 'icon-plus icon-white'
          ),
        array(
            'label'       => Yii::t('system', 'Создать'), 
            'url'         => array('create'), 
            'type'        => 'info',
            'icon'        => 'icon-plus icon-white'
            ),
        array(
            'label'       => Yii::t('system', 'Поиск'), 
            'url'         => '#', 
            'type'        => 'info',
            'icon'        => 'icon-plus icon-white',
            'htmlOptions' => array('class'=>'search-button btn'),
            ),
    );

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('<?php echo $this->class2id($this->modelClass); ?>-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<div class="search-form  row-fluid" style="display:none">
<?php echo "<?php \$this->renderPartial('_search',array(
	'model'=>\$model,
)); ?>\n"; ?>
</div><!-- search-form -->

<?php echo "<?php"; ?> $this->widget('bootstrap.widgets.TbGridView',array(
	'id'=>'<?php echo $this->class2id($this->modelClass); ?>-grid',
        'type'=>'striped bordered condensed',
        'template'=>'{summary}{items}{pager}',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
<?php
$count=0;
foreach($this->tableSchema->columns as $column)
{
    if(++$count==7)
            echo "\t\t/*\n";
    echo "\t\t'".$column->name."',\n";
}
if($count>=7)
    echo "\t\t*/\n";
?>
//               array(
//                    'name'=>'lang_id',
//                    'value'=>'$data->lang->l',
//                    'filter'=>CHtml::listData($model()->findAll(), 'id', 'l'),
//                ),
            array(
                'class'     => 'bootstrap.widgets.TbButtonColumn',
                'template'  => '{view}{update}{delete}',
            ),
	),
    )); 
?>